home *** CD-ROM | disk | FTP | other *** search
- // Symbiont.h
- //
- // Scott Mulligan
- //
- // Copyright © 1996 Apple Computer, Inc.
- // All rights reserved.
-
- #define HEARTBEAT_SEND 30*60 // How often to send a heartbeat
- #define HEARTBEAT_CHECK 30*60 // How often to check to see if we got one
- #define MAX_MISSED_HEARTBEATS 3 // How many missed heartbeats is too many
-
- #define kSymbioticStrings 1000 // Rsrc ID of STR#
-
- #define ePPCError 1 // String indices
- #define eOurMachine 2
- #define eVersion 3
- #define eAESend 4
-
- #define TRUE 1
- #define FALSE 0
-
- /* These #defines correspond to values in the Pascal source code.
- TESample.c and TESample.r include this file. */
-
- /* Determining an application's minimum size to request from MultiFinder depends
- on many things, each of which can be unique to an application's function,
- the anticipated environment, the developer's attitude of what constitutes
- reasonable functionality and performance, etc. Here is a list of some things to
- consider when determining the minimum size (and preferred size) for your
- application. The list is pretty much in order of importance, but by no means
- complete.
-
- 1. What is the minimum size needed to give almost 100 percent assurance
- that the application won't crash because it ran out of memory? This
- includes not only things that you do have direct control over such as
- checking for NIL handles and pointers, but also things that some
- feel are not so much under their control such as QuickDraw and the
- Segment Loader.
-
- 2. What kind of performance can a user expect from the application when
- it is running in the minimum memory configuration? Performance includes
- not only speed in handling data, but also things like how many documents
- can be opened, etc.
-
- 3. What are the typical sizes of scraps is [a boy dog] that a user might
- wish to work with when lauching or switching to your application? If
- the amount of memory is too small, the scrap may get lost [will have
- to be shot]. This can be quite frustrating to the user.
-
- 4. The previous items have concentrated on topics that tend to cause an
- increase in the minimum size to request from MultiFinder. On the flip
- side, however, should be the consideration of what environments the
- application may be running in. There may be a high probability that
- many users with relatively small memory configurations will want to
- avail themselves of your application. Or, many users might want to use it
- while several other, possibly related/complementary applications are
- running. If that is the case, it would be helpful to have a fairly
- small minimum size.
-
- What we did for TESample:
-
- We determined the smallest heap size that TESample could have and still
- run (22K). For the preferred size we added enough space to permit:
- a. a maximum size TextEdit text handle (32000 characters)
- b. a maximum usable TextEdit scrap (32000 characters)
- b. a maximum scrap as a result of Copy (32000 characters)
- d. a little performance cushion (see 2, above) (10K)
- Result: 122K for preferred size
-
- For the minimum size we took the 22K and then scaled down our requirements
- for a,b, and c above. We thought that providing 16K more would be lean
- and mean (see 4, above).
- Result: 38K for minimum size
- */
-
- #define kPrefSize 122
- #define kMinSize 38
-
- /* The following constants are used to identify menus and their items. The menu IDs
- have an "m" prefix and the item numbers within each menu have an "i" prefix. */
- #define mApple 128 /* Apple menu */
- #define iAbout 1
-
- #define mFile 129 /* File menu */
- #define iNew 1
- #define iQuit 2
-
- #define mEdit 130 /* Edit menu */
- #define iUndo 1
- #define iCut 3
- #define iCopy 4
- #define iPaste 5
- #define iClear 6
-
- /* 1.01 - kTopLeft - This is for positioning the Disk Initialization dialogs. */
-
- #define kDITop 0x0050
- #define kDILeft 0x0070
-
- /* kMaxOpenDocuments is used to determine whether a new document can be opened
- or created. We keep track of the number of open documents, and disable the
- menu items that create a new document when the maximum is reached. If the
- number of documents falls below the maximum, the items are enabled again. */
- #define kMaxOpenDocuments 1
-
- /* kMaxDocWidth is an arbitrary number used to specify the width of the TERec's
- destination rectangle so that word wrap and horizontal scrolling can be
- demonstrated. */
- #define kMaxDocWidth 576
-
- /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
- SysEnvRec we understand. */
- #define kSysEnvironsVersion 1
-
- /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
- by MultiFinder. Once we determine that an event is an OSEvent, we look at the
- high byte of the message sent to determine which kind it is. To differentiate
- suspend and resume events we check the resumeMask bit. */
- #define kOSEvent app4Evt /* event used by MultiFinder */
- #define kSuspendResumeMessage 1 /* high byte of suspend/resume event message */
- #define kResumeMask 1 /* bit of message field for resume vs. suspend */
- #define kMouseMovedMessage 0xFA /* high byte of mouse-moved event message */
- #define kNoEvents 0 /* no events mask */
-
- /* 1.01 - kMinHeap - This is the minimum result from the following
- equation:
-
- ORD(GetApplLimit) - ORD(ApplicZone)
-
- for the application to run. It will insure that enough memory will
- be around for reasonable-sized scraps, FKEYs, etc. to exist with the
- application, and still give the application some 'breathing room'.
- To derive this number, we ran under a MultiFinder partition that was
- our requested minimum size, as given in the 'SIZE' resource. */
-
- #define kMinHeap (29 * 1024)
-
- /* 1.01 - kMinSpace - This is the minimum result from PurgeSpace, when called
- at initialization time, for the application to run. This number acts
- as a double-check to insure that there really is enough memory for the
- application to run, including what has been taken up already by
- pre-loaded resources, the scrap, code, and other sundry memory blocks. */
-
- #define kMinSpace (20 * 1024)
-
- /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
- #define kExtremeNeg -32768
- #define kExtremePos (32767 - 1) /* required to address an old region bug */
-
- /* kTESlop provides some extra security when pre-flighting edit commands. */
- #define kTESlop 1024
-
- /* The following are indicies into STR# resources. */
- #define eWrongMachine 1
- #define eSmallSize 2
- #define eNoMemory 3
- #define eNoSpaceCut 4
- #define eNoCut 5
- #define eNoCopy 6
- #define eExceedPaste 7
- #define eNoSpacePaste 8
- #define eNoWindow 9
- #define eExceedChar 10
- #define eNoPaste 11
-
- #define rMenuBar 128 /* application's menu bar */
- #define rUserAlert 1000 /* user error alert */
- #define kErrStrings 128 /* error string list */
-